package com.ruoyi.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wx.domain.TGarbagesort;
import com.ruoyi.wx.service.ITGarbagesortService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: wind
 * @CreateTime: 2020-05-01
 * @Description:
 */

@RestController
@RequestMapping("/api")
public class ApiTgarbagesortController {
    @Autowired
    private ITGarbagesortService itGarbagesortService;


    /**
     * 查询所有的分类
     * */
    @RequestMapping("/list")
    public List<TGarbagesort> list() {
        return itGarbagesortService.list();
    }

    /**
     * 查询所有的分类
     * */
    @RequestMapping("/test")
    public AjaxResult test(TGarbagesort garbagesort) {

        return AjaxResult.success(itGarbagesortService.listRand(garbagesort));
    }

    /**
     * 搜索
     * */
    @RequestMapping("/qsearch")
    @Async
    public AjaxResult list(TGarbagesort tGarbagesort) {
        return AjaxResult.success(itGarbagesortService.list(new QueryWrapper<>(tGarbagesort)));
    }
}



